<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            padding: 0;
        }
        
        .container {
            width: 90%;
            margin: 0 auto;
            height: 400px;
            background-color: pink;
        }
        
        .left {
            width: 200px;
            height: 400px;
            background-color: aquamarine;
            font-size: 70px;
            line-height: 400px;
            text-align: center;
            float: left;
        }
        
        .right {
            height: 400px;
            background-color: yellowgreen;
            font-size: 70px;
            line-height: 400px;
            text-align: center;
            /* 1.子元素都浮动，动态计算出右边容器的宽度 */
            float: left;
            width: calc(100% - 200px);

            /* 2.左侧浮动，右侧容器通过margin偏移左侧容器的宽度 */
            /* margin-left: 200px; */

            /* 3.左侧浮动，右侧创建BFC消除浮动的覆盖影响(右侧盒子宽度有缺陷) */
            /* overflow: hidden; */
        }
        
        .clearfix::after {  /*清除浮动造成的影响*/
            content: '';
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="left">定宽</div>
        <div class="right">自适应</div>
    </div>
    <h2>浮动实现两列响应式布局</h2>
</body>



</html>